Git init: prompt for branch + create GitHub remote#401
Git init: prompt for branch + create GitHub remote#401Samigos wants to merge 10 commits intoDimillian:mainfrom
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e700876164
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!ok) { | ||
| setInitGitRepoPrompt((prev) => | ||
| prev ? { ...prev, error: prev.error ?? "Failed to initialize Git repository." } : prev, | ||
| ); |
There was a problem hiding this comment.
Don't treat canceled init confirmation as failure
handleInitGitRepoPromptConfirm sets an error whenever initGitRepo(...) returns false, but useGitActions.initGitRepo also returns false for the intentional cancel path when the non-empty-folder ask(...) dialog is declined. In that scenario the UI now shows “Failed to initialize Git repository.” even though no operation failed, which is misleading and degrades the init flow UX. Please distinguish cancel vs. failure before setting this error.
Useful? React with 👍 / 👎.
# Conflicts: # src-tauri/src/bin/codex_monitor_daemon/rpc.rs # src-tauri/src/shared/git_ui_core.rs # src/App.tsx
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e7f8f95a9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| format!("{owner}/{repo}") | ||
| }; | ||
|
|
||
| if origin_url_before.is_none() { |
There was a problem hiding this comment.
Validate existing origin matches requested repository
When origin already exists, this branch skips creating/fetching the requested full_name, but the function still pushes with git push -u origin HEAD and then patches /repos/{full_name}. In retry scenarios after a partial setup (for example, first attempt created origin but push failed), changing the repo name will push to the old origin while API calls and returned metadata target the new name, which can publish to the wrong repository and misreport what was configured.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70f7c6949d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let output = tokio_command("gh") | ||
| .args(args) | ||
| .current_dir(repo_root) | ||
| .output() |
There was a problem hiding this comment.
Set PATH when spawning gh commands
create_github_repo relies on run_gh_command, but this helper launches gh without the PATH augmentation used by run_git_command (git_env_path). In GUI-launched environments (notably macOS apps started outside a shell), Homebrew locations like /opt/homebrew/bin are often missing from PATH, so the new GitHub-repo flow fails with Failed to run gh even when gh is installed. Apply the same PATH handling (or explicit binary resolution) here so the feature works in packaged app contexts.
Useful? React with 👍 / 👎.
| if trimmed.starts_with('/') || trimmed.ends_with('/') { | ||
| return Err("Branch name cannot start or end with '/'.".to_string()); | ||
| } |
There was a problem hiding this comment.
Reject branch names with repeated slashes
The new branch validator allows values like foo//bar, but Git rejects these refs (git init --initial-branch foo//bar fails with an invalid branch error). Because this passes validation and fails only after submitting the init flow, users hit a runtime failure instead of immediate input feedback. Add an explicit // rejection (or delegate to git check-ref-format) before running init commands.
Useful? React with 👍 / 👎.
|
@codex any other issues? |
|
To use Codex here, create an environment for this repo. |
|
@Dimillian I think we're good to go on this one. If you could also invoke the codex review, it'd be better. |
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |

Adds an Initialize Git flow for non-git workspaces.
gh, add origin, push HEAD, set default branch.Tests: